package com.acme.bankapp.domain.bank;

import java.util.Calendar;

import com.acme.bankapp.domain.bank.Client;

public class Bank {
	private Client[] clients = new Client[10];
	private ClientRegistrationListener[] listeners;

	public Bank() {
	}

	public Bank(ClientRegistrationListener[] listeners) {
		this.listeners = listeners;
	}

	public static class DebugListener implements ClientRegistrationListener {
		public void onClientAdded(Client client) {
			if (client != null) {
				Calendar calendar = Calendar.getInstance();
				//used to prevent date printing, can be replaced by using formatter
				System.out.println(client.getClientSalutation() + " "
						+ calendar.get(Calendar.HOUR) + ":"
						+ calendar.get(Calendar.MINUTE) + ":"
						+ calendar.get(Calendar.SECOND) + ", "
						+ calendar.get(Calendar.MILLISECOND) + "ms");
			}
		}
	}

	public static class EmailNotificationListener implements ClientRegistrationListener {
		@Override
		public void onClientAdded(Client client) {
			System.out.println("Notification email for client "
					+ client.getClientSalutation() + " to be sent");
		}
	}

	public static class PrintClientListener implements ClientRegistrationListener {
		@Override
		public void onClientAdded(Client client) {
			System.out.println("New client added: "
					+ client);
		}
	}

	public Client[] getClients() {
		return clients;
	}

	public void setClients(Client[] clients) {
		this.clients = clients;
	}

	public ClientRegistrationListener[] getListeners() {
		return listeners;
	}
}
